Skip to content

Fix HTTP/2 stream semaphore leak#2162

Open
hyperxpro wants to merge 1 commit intomainfrom
fix-semaphore-leak
Open

Fix HTTP/2 stream semaphore leak#2162
hyperxpro wants to merge 1 commit intomainfrom
fix-semaphore-leak

Conversation

@hyperxpro
Copy link
Copy Markdown
Member

Motivation:

HTTP/2 multiplexed requests randomly time out (~0.5%) under load because stream slots leak when Http2StreamChannelBootstrap.open() fails, eventually starving the connection. Secondary bugs — parent channel attribute overwrite, empty handleChannelInactive(), and a TOCTOU race in addPendingOpener() — amplify the issue by leaving failed requests undetected.

Modification:

Release stream slots on all failure paths in openHttp2Stream(), skip setAttribute() on HTTP/2 parent channels, implement handleChannelInactive()/handleException() in Http2Handler, set active token on stream channels, and synchronize addPendingOpener/drainPendingOpeners to eliminate the race condition.

Result:

Zero silent timeouts under concurrent HTTP/2 load with connection disruptions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant